package com.chis.gencode;

import com.chis.encode.aes.AesUtil;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Base64;
import java.util.zip.GZIPInputStream;

public class Test {

    public static void main(String[] args) throws IOException {
//        String s = "3VyosVSe36aeeNWeQPp/vFqdmJhgOEzjjIhUiG8YhyKMy0laWcGmoSZYMi/K5ltnGaMk/jMBA1rmJnirLlU8O8Hc2AGUgNcYgYZQ0z0STpW9Pc9ADFMluslhkxNH8tBFytXTU+/7b269/BdjsjPQptTUahq+mxydarBquofBTBgml2DaWMMiHsQ2yN+I/WnkdNSq/JZbutBWL0vcXmYvZQCOPqukvOnkoLXGX2QiPPfH9fiBtYKCH0NGgU6aDWUW2IfHZHcBq5VhyY8nklQWk6bv7qElAerloDJ1f3q/CEOW+O/EuKPK+git63sAk8oHiMDYyExUdoRbB3JumIG6OnZr0nD1KM9a0Bo2W8Be5Upm/78nw9lHzaviacwyxDn35OZN8HUDWYLpLLwK3xhfJrXMCbebpJB3Ii3hPxhcb0kiBJHLIIUJin5kPaEZEGlP2vv29lsqdXevZG73Pjd4yNm/11mqfDw41RaGsA0nEJo=";
//        byte[] decode = Base64.getDecoder().decode(s);
//
//        byte[] decrypt = AesUtil.decrypt(decode, "1234");
//
//        ByteArrayOutputStream out = new ByteArrayOutputStream();
//        ByteArrayInputStream in = new ByteArrayInputStream(decrypt);
//        GZIPInputStream gzipInputStream = new GZIPInputStream(in);
//        byte[] buffer = new byte[256];
//        int n;
//        while ((n = gzipInputStream.read(buffer)) >= 0) {
//            out.write(buffer, 0, n);
//        }
//        String ss =  out.toString("UTF-8");
//        System.out.println(ss);



        String s = "H4sIAAAAAAAAALOxr8jNUShLLSrOzM+zVTfUM1BXSM1Lzk/JzEu3VU9PMjI2NFK3t7MJzi32zEvLTy2GM+1sQotTi5zzU1LtEgsKbPThPJuQ1By/0lw7Q2NLI0NDSzMTU2MbfaiYjXN+XklqXondkV87bxxctfXIxmUbt1x8eW3JodfnVi3cYGhkbLJw4+I1x1/v2XBq45Vb5xZdOHrtAkhew8hg+7Vrl4/cunzhwnLNhYtt9GEmAY0sBVKGIBEQw8YzrywxJzPFJbEk1c7IwMhA18BS18DMRh9Z3Ca4ICQxHaQJwrDxLPbLTM8AGwNj2gRXFpek5vomFmXb5ZXm5ADVIgRsgjPT8+wW7rt24dyBC0f3H9uzZ+F+oAKQIJCChZA+ItgAw+Ddt2kBAAA=";
        byte[] decode = Base64.getDecoder().decode(s);


        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ByteArrayInputStream in = new ByteArrayInputStream(decode);
        GZIPInputStream gzipInputStream = new GZIPInputStream(in);
        byte[] buffer = new byte[256];
        int n;
        while ((n = gzipInputStream.read(buffer)) >= 0) {
            out.write(buffer, 0, n);
        }
        String ss =  out.toString("GBK");
        System.out.println(ss);

    }
}
